package com.example.common.feign;

import com.example.common.domain.UserRole;
import com.example.common.dto.ApiResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * FeignClient接口，用于调用权限服务
 */
@FeignClient(name = "permission-service")
public interface PermissionFeignClient {

    //绑定用户角色
    @PostMapping("/permission/bind-default-role/{userId}")
    ApiResponse<Void> bindDefaultRole(@PathVariable("userId") Long userId);

    //获取用户角色
    @GetMapping("/permission/user-role/{userId}")
    ApiResponse<String> getUserRoleCode(@PathVariable("userId") Long userId);

    //升级为管理员
    @PostMapping("/permission/upgrade-to-admin/{userId}")
    ApiResponse<Void> upgradeToAdmin(@PathVariable("userId") Long userId);

    //降级为普通用户
    @PostMapping("/permission/downgrade-to-user/{userId}")
    ApiResponse<Void> downgradeToUser(@PathVariable("userId") Long userId);
}